<template>
  <div class="seach">
    <div class="header">
      <div class="header_left">
        <van-icon name="search" size="18"/>
        <input type="text" placeholder="请输入商品名称">
      </div>
      <div class="header_right" @click="toBack">
        取消
      </div>
    </div>
    <div class="content">
      <h2>热门搜索</h2>
      <div class="con_box">
        <div v-for="(item,index) in hotKeywordVOList" :key="index">
          {{item.keyword}}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import url from '@/api/url'
export default {
  data () {
    return {
      hotKeywordVOList: []
    }
  },
  methods: {
    toBack () {
      this.$router.go(-1)
    }
  },
  created () {
    // 请求数据
    this.$http.post(url.getSearchInfo)
      .then((res) => {
        this.hotKeywordVOList = res.data.hotKeywordVOList
      })
    // 隐藏底部导航
    this.$store.commit('setFotShow', false)
  },
  destroyed () {
    this.$store.commit('setFotShow', true)
  }
}
</script>

<style lang='less' scoped>
.seach{
  height: 100vh;
  background-color: #f5f5f5;
  .header{
    height: .88rem;
    padding: 0 .3rem;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .header_left{
      width: 6.04rem;
      height: .56rem;
      background-color: #f4f4f4;
      display: flex;
      align-items: center;
      .van-icon{
        margin: 0 .15rem;
      }
      input{
        width: 5.2rem;
        border: none;
        line-height: .4rem;
        padding-left: .02rem;
        font-size: .28rem;
        color: rgba(0,0,0,.8);
        background-color: #f4f4f4;
      }
    }
    .header_right{
      font-size: .28rem;
    }
  }
  .content{
    padding: 0 .3rem .3rem;
    background-color: #fff;
    h2{
      font-size: .28rem;
      color: #999;
      line-height: .9rem;
    }
    .con_box{
      display: flex;
      flex-wrap: wrap;
      div{
        padding: 0 .15rem;
        margin-right: .32rem;
        margin-bottom: .32rem;
        line-height: .46rem;
        border: 1px solid #999;
        border-radius: 4px;
        color: #333;
        font-size: .24rem;
      }
    }
  }
}
</style>
